package edu.sctu.zhu.dao;

import edu.sctu.zhu.bean.Workorder;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by zhu on 2015/11/24.
 */
@Repository
public interface WorkorderDao extends CrudRepository<Workorder,Long>{

    @Query(value = "select * from workorder where order_number=?",nativeQuery = true)
    public List<Workorder> findIdByOrderNumber(String orderNumber);

    @Query(value = "select * from workorder where fans_id=?",nativeQuery = true)
    public List<Workorder> findByFansId(Long id);

    @Query(value = "select * from workorder where users_id=?",nativeQuery = true)
    public List<Workorder> findAllGoods(Long id);

    @Query(value = "select * from workorder where users_id=? AND order_status=?",nativeQuery = true)
    public List<Workorder> findByOrderStatus(Long userId,int status);

    @Query(value = "SELECT * FROM workorder WHERE order_status != 1 AND order_status != 6",nativeQuery = true)
    public List<Workorder> findPayOrder();
}
